package edu.sctu.jarime.june.day20150607.ThreadUsed;

/**
 * Created by user19 on 2015/6/7.
 */
public class UsedThread {

        public static void main(String[] arg) {
            ThreadTest tt = new ThreadTest();
            tt.start();
        }


    static class ThreadTest extends Thread {
        public void run() {
            long begin = System.currentTimeMillis();//取开始时间 单位是毫秒
            for(int i = 0; i < 10; i++) {
                System.out.println("线程运行中...");
                try {
                    sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            long end = System.currentTimeMillis();//取结束时间
            System.out.println("一共运行了" + (end - begin) + "毫秒");
        }
    }


}
